#! /bin/bash

. ./scripts/shell/common.sh
. ./scripts/shell/golang.sh
. ./scripts/shell/tool.sh

PRE_HOOK="./scripts/hooks/pre-test.sh"
END_HOOK="./scripts/hooks/end-test.sh"

if [ -f ${PRE_HOOK} ];then
. ${PRE_HOOK}
fi

${YS_CLI} go test

# 判断 test 结果失败时 不执行hook
if [[ "$?" != 0 ]]
then
    exit 1
fi

if [ -f ${END_HOOK} ];then
. ${END_HOOK}
fi
